package service.impl;

import dao.IBookDao;
import dao.impl.BookDao;
import domain.Book;
import service.IBookService;

import java.sql.SQLException;
import java.util.List;

public class BookService implements IBookService {
    //父类的引用指向子类的对象
    IBookDao bookDao = new BookDao();
    @Override
    public List selectBooks() {
        return bookDao.selectBooks();
    }

    @Override
    public int insertBook(Book book) throws SQLException {
        return bookDao.insertBook(book);
    }
    public String deleteBook(String num){
        return bookDao.deleteBook(num);
    }
    //  修改图书
    public int updateBook(Book book) throws SQLException {
        return bookDao.updateBook(book);
    }
    //借阅修改图书状态
    public int updateBookState(Book book) throws SQLException {
        return bookDao.updateBookState(book);
    }
    //归还图书
    public int returnBookState(Book book) throws SQLException {
        return bookDao.returnBookState(book);
    }
}
